package pub.model;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Order entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "order", catalog = "sddf")
public class Order implements java.io.Serializable {

	// Fields

	private Integer id;
	private Sent sent;
	private Company company;
	private Service service;
	private Province province;
	private Gift gift;
	private String name;
	private Integer telephone;
	private String address;
	private String note;
	private Boolean pay;
	private String number;
	private Integer end;
	private Date payTime;
	private Date sentTime;
	private Date endTime;
	private Set<Goods> goodses = new HashSet<Goods>(0);

	// Constructors

	/** default constructor */
	public Order() {
	}

	/** minimal constructor */
	public Order(String name, Integer telephone, String address, Boolean pay) {
		this.name = name;
		this.telephone = telephone;
		this.address = address;
		this.pay = pay;
	}

	/** full constructor */
	public Order(Sent sent, Company company, Service service, Province province, Gift gift, String name, Integer telephone, String address,
			String note, Boolean pay, String number, Integer end, Date payTime, Date sentTime, Date endTime, Set<Goods> goodses) {
		this.sent = sent;
		this.company = company;
		this.service = service;
		this.province = province;
		this.gift = gift;
		this.name = name;
		this.telephone = telephone;
		this.address = address;
		this.note = note;
		this.pay = pay;
		this.number = number;
		this.end = end;
		this.payTime = payTime;
		this.sentTime = sentTime;
		this.endTime = endTime;
		this.goodses = goodses;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "sent")
	public Sent getSent() {
		return this.sent;
	}

	public void setSent(Sent sent) {
		this.sent = sent;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "company")
	public Company getCompany() {
		return this.company;
	}

	public void setCompany(Company company) {
		this.company = company;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "service")
	public Service getService() {
		return this.service;
	}

	public void setService(Service service) {
		this.service = service;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "province")
	public Province getProvince() {
		return this.province;
	}

	public void setProvince(Province province) {
		this.province = province;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "gift")
	public Gift getGift() {
		return this.gift;
	}

	public void setGift(Gift gift) {
		this.gift = gift;
	}

	@Column(name = "name", nullable = false, length = 10)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "telephone", nullable = false)
	public Integer getTelephone() {
		return this.telephone;
	}

	public void setTelephone(Integer telephone) {
		this.telephone = telephone;
	}

	@Column(name = "address", nullable = false, length = 200)
	public String getAddress() {
		return this.address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	@Column(name = "note", length = 200)
	public String getNote() {
		return this.note;
	}

	public void setNote(String note) {
		this.note = note;
	}

	@Column(name = "pay", nullable = false)
	public Boolean getPay() {
		return this.pay;
	}

	public void setPay(Boolean pay) {
		this.pay = pay;
	}

	@Column(name = "number", length = 30)
	public String getNumber() {
		return this.number;
	}

	public void setNumber(String number) {
		this.number = number;
	}

	@Column(name = "end")
	public Integer getEnd() {
		return this.end;
	}

	public void setEnd(Integer end) {
		this.end = end;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "payTime", length = 10)
	public Date getPayTime() {
		return this.payTime;
	}

	public void setPayTime(Date payTime) {
		this.payTime = payTime;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "sentTime", length = 10)
	public Date getSentTime() {
		return this.sentTime;
	}

	public void setSentTime(Date sentTime) {
		this.sentTime = sentTime;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "endTime", length = 10)
	public Date getEndTime() {
		return this.endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "order")
	public Set<Goods> getGoodses() {
		return this.goodses;
	}

	public void setGoodses(Set<Goods> goodses) {
		this.goodses = goodses;
	}

}